﻿//using ArtMath.Components;
//using ArtMath.Components.Lines;
//using ArtMath.Helpers;
//using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Drawing.Design;
//using System.Linq;
//using System.Text;
//using System.Windows.Forms.Design;

//namespace ArtMath
//{
//    class teFormula:UITypeEditor
//    {
//        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
//        {
//            if (context?.Instance != null)
//            {
//                return UITypeEditorEditStyle.DropDown;
//            }
//            return base.GetEditStyle(context);
//        }
//        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
//        {
//            if (context?.Instance != null && provider != null)
//            {
//                IWindowsFormsEditorService es = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
//                if (es != null)
//                {
//                    string exp;
//                    ucFormula editor;
//                    if (context.Instance is Array)
//                    {
//                        ShapeBase[] objs = context.Instance as ShapeBase[];
//                        string[] exps = new string[objs.Length];
//                        for (int i = 0; i < exps.Length; i++)
//                        {
//                            exps[i] = (objs[i] as Function).FunctionExpression;
//                        }
//                        exp = Utility.Same(exps) ? exps[0] : string.Empty;
//                        editor = new ucFormula(exp);
//                    }
//                    else
//                    {
//                        exp = (context.Instance as Function).FunctionExpression;
//                        editor = new ucFormula(exp);
//                    }
//                    es.DropDownControl(editor);
//                    value = editor.nS;
//                    return value;
//                }
//            }
//            return value;
//        }
//    }
//}
